/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_typeformation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvTypeformation.findAll", query = "SELECT c FROM CvTypeformation c"),
    @NamedQuery(name = "CvTypeformation.findByIdtypeformation", query = "SELECT c FROM CvTypeformation c WHERE c.idtypeformation = :idtypeformation"),
    @NamedQuery(name = "CvTypeformation.findByFormationcol", query = "SELECT c FROM CvTypeformation c WHERE c.formationcol = :formationcol")})
public class CvTypeformation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtypeformation")
    private Integer idtypeformation;
    @Basic(optional = false)
    @Column(name = "formationcol")
    private String formationcol;
    @Lob
    @Column(name = "commentaire")
    private String commentaire;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idtypeformation", fetch = FetchType.LAZY)
    private List<CvFormation> cvFormationList;

    public CvTypeformation() {
    }

    public CvTypeformation(Integer idtypeformation) {
        this.idtypeformation = idtypeformation;
    }

    public CvTypeformation(Integer idtypeformation, String formationcol) {
        this.idtypeformation = idtypeformation;
        this.formationcol = formationcol;
    }

    public Integer getIdtypeformation() {
        return idtypeformation;
    }

    public void setIdtypeformation(Integer idtypeformation) {
        this.idtypeformation = idtypeformation;
    }

    public String getFormationcol() {
        return formationcol;
    }

    public void setFormationcol(String formationcol) {
        this.formationcol = formationcol;
    }

    public String getCommentaire() {
        return commentaire;
    }

    public void setCommentaire(String commentaire) {
        this.commentaire = commentaire;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvFormation> getCvFormationList() {
        return cvFormationList;
    }

    public void setCvFormationList(List<CvFormation> cvFormationList) {
        this.cvFormationList = cvFormationList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtypeformation != null ? idtypeformation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvTypeformation)) {
            return false;
        }
        CvTypeformation other = (CvTypeformation) object;
        if ((this.idtypeformation == null && other.idtypeformation != null) || (this.idtypeformation != null && !this.idtypeformation.equals(other.idtypeformation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvTypeformation[ idtypeformation=" + idtypeformation + " ]";
    }
    
}
